package com.zmn.plat.services.impl.part;

import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.zmn.plat.model.entity.part.PartSkuRelation;
import com.zmn.plat.model.entity.part.PartSkuRelationDTO;
import com.zmn.plat.persistence.interfaces.part.PartSkuRelationDAO;
import com.zmn.plat.services.interfaces.part.PartSkuRelationService;

@Service
public class PartSkuRelationServiceImpl implements PartSkuRelationService {

    @Autowired
    private PartSkuRelationDAO dao;

    @Override
    public PartSkuRelation findByKey(Integer relationId) {
        return dao.findByKey(relationId);
    }

    @Override
    public List<PartSkuRelationDTO> listByOneSkuId(Integer oneSkuId) {
        return dao.listByOneSkuId(oneSkuId);
    }

    @Override
    public List<PartSkuRelationDTO> listByOneSkuIds(List<Integer> oneSkuIds) {
        return dao.listByOneSkuIds(oneSkuIds);
    }

    @Override
    public int updateByKey(PartSkuRelation record) {
        record.setUpdateTime(new Date());
        return dao.updateByKey(record);
    }

    @Override
    public int insert(PartSkuRelation record) {
        record.setCreateTime(new Date());
        return dao.insert(record);
    }

    @Override
    public int deleteByKey(Integer relationId) {
        return dao.deleteByKey(relationId);
    }
}
